package com.qqt.csr.im.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @Author: yang hao
 * @Date: 2024/10/16 17:11
 * @Description: 图片类型枚举，顺序不要随意变动
 **/
@Getter
public enum ImageFormatEnum {

    jpg(0, "jpg"),

    gif(1, "gif"),

    png(2, "png"),

    bmp(3, "bmp"),

    svg(4, "svg"),

    jpeg(5, "jpeg"),

    other(6, "其他")

    ;

    private final Integer code;

    private final String desc;

    ImageFormatEnum(final Integer code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static final ImageFormatEnum[] ENUMS = ImageFormatEnum.values();

    public static ImageFormatEnum matchEnum(Integer value) {
        return Arrays.stream(values()).filter(ele -> Objects.equals(ele.code, value)).findFirst().orElse(null);
    }

}
